//
// Created on 2025/7/24.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#ifndef AVCODECVIDEO_IMAGEASSET_H
#define AVCODECVIDEO_IMAGEASSET_H

#include "Asset.h"
#include "i_gl_render_engine.h"

class OH_PixelmapNative;
class OH_NativeBuffer;
struct StaticImageInfo;

class ImageAsset : public Asset {
public:
    ImageAsset(const std::string& path);
    ~ImageAsset() override;
    
    void SetPositionX(float positionX);
    void SetPositionY(float positionY);
    void SetScale(float scale);
    void SetRotate(float rotate);
    
    void Release();
    void PrepareImage(float originX = 0.0f, float originY = 0.0f);
    std::shared_ptr<ImageInfoBase> GetImageInfo();
    const float GetPositionX();
    const float GetPositionY();
    const float GetScale();
    const float GetRotate();
    const uint32_t GetHeight();    
    const uint32_t GetWidth();
    
    void PrepareImageInfo();
    bool IsGif();
    
private:
    void PrePareNativeBuffer();
    void DecodeToPixelmap();
    
    float m_positionX{0};
    float m_positionY{0};
    uint32_t m_width{0};
    uint32_t m_height{0};
    bool m_isHdr{false};
    bool m_isPrepared{false};
    float m_scale{1.0f};
    float m_rotate{0.0f};
    bool m_isGif{false};
    uint32_t m_frameCount{1};
    std::vector<int32_t> m_delayTimeList{};
    std::vector<OH_PixelmapNative*> m_pixelMapList{};
    std::vector<OH_NativeBuffer*> m_nativeBufferList{};
    std::shared_ptr<ImageInfoBase> m_ImageInfo{nullptr};
};


#endif //AVCODECVIDEO_IMAGEASSET_H
